package com.project.restaurant.user.enums;

public enum Sex {
    FEMALE(false,"女"),
    MALE(true,"男");
    private boolean sex;
    private String desc;
    Sex(boolean sex,String sexDesc){
        this.sex = sex;
        this.desc = sexDesc;
    }


    public boolean isSex() {
        return sex;
    }

    public String getDesc() {
        return desc;
    }

    public static Sex getSex(boolean sex){
        Sex[] sexes = Sex.values();
        for(Sex s:sexes){
            if(s.isSex() == sex){
                return s;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return desc;
    }
}
